﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using static NPOI.HSSF.UserModel.HeaderFooter;

namespace Simple.Repository.Models.ClassRoom
{
    /// <summary>
    /// 巡检记录
    /// </summary>
    public class InspectionRecord : BusinessFullEntityBase<Guid>
    {
        public Guid GardenHouseClassRoomId { get; set; }

        /// <summary>
        /// 责任人
        /// </summary>
        public Guid? ResponsiblePerson { get; set; }

        /// <summary>
        /// 风险编号
        /// </summary>
        public string? RiskNumber { get; set; }

        /// <summary>
        /// 风险源名称
        /// </summary>
        public string? RiskSourceName { get; set; }

        /// <summary>
        /// 风险因素
        /// </summary>
        public string? RiskFactors { get; set; }

        /// <summary>
        /// 风险类别
        /// </summary>
        public string? RiskCategory { get; set; }

        /// <summary>
        /// 风险等级
        /// </summary>
        public int RiskLevel { get; set; }

        /// <summary>
        /// 可能导致的事故及后果
        /// </summary>
        public string? PossibleAccidents { get; set; }

        /// <summary>
        /// 现场照片
        /// </summary>
        public string? Fields { get; set; }

        /// <summary>
        /// 管控依据
        /// </summary>
        public string? ControlBasis { get; set; }

        /// <summary>
        /// 巡检人
        /// </summary>
        public Guid? InspectionPerson { get; set; }  

        /// <summary>
        /// 教室信息
        /// </summary>
        public GardenHouseClassRoom GardenHouseClassRoom { get; set; }

        public override void ConfigureEntity(ModelBuilder builder)
        {
            builder.Entity<InspectionRecord>(entity =>
            {
                entity.HasOne(c => c.GardenHouseClassRoom).WithMany(c => c.InspectionRecords).HasForeignKey(c => c.GardenHouseClassRoomId);
            });
        }
    }
}
